package Demo7;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class DataStream {
    public static void write(){
        try {
            DataOutputStream dos = new DataOutputStream(new FileOutputStream("f:/TEST/a.exe"));
            dos.writeChar('c');
            dos.writeDouble(99.99);
            dos.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        write();
        Read();
    }
    public static void Read(){
        try {
            DataInputStream dis = new DataInputStream(new FileInputStream("f:/TEST/a.exe"));
            System.out.println(dis.readChar());
            System.out.println(dis.readDouble());
            dis.close();
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
